package se.webbzon.boltzmann.menu;

import java.awt.image.ImageObserver;

public class GraphicPage extends MFlowPage {

	// The layout of this page
	private final AbstractGameMenuLayout layout;
	
	/*============================================================
	Constructors
	============================================================*/
	
	public GraphicPage(ImageObserver observer, AbstractGameMenuLayout layout, MPage parent) {
		super(observer, layout.getPageLayout(),parent,"Graphics");
		this.layout = layout;
		
		addItem(new PageLabel(observer, layout.getLabelLayout(),this));
		addRow(0.25);
		addItem(new ReturnButton(observer, layout.getButtonLayout(), parent));
		addRow();
		addItem(new ResolutionButton(layout.getButtonLayout()));
		addRow();
		addItem(new EffectButton(layout.getButtonLayout()));
	}
	
	/*============================================================
	Public Methods
	============================================================*/

	@Override public void onEnter(GameMenu menu) {}

	@Override public void onLeave(GameMenu menu) {}
	
	/*============================================================
	Private Classes
	============================================================*/
	
	private final class ResolutionButton extends MButton {

		public ResolutionButton(ButtonLayout layout) {
			super(getImageObserver(), layout, false, "Resolution");
		}

		@Override public void onClick(GameMenu menu) {
			menu.setPage(new ResolutionPage(getImageObserver(), layout,GraphicPage.this));
		}
		
	}
	
	private final class EffectButton extends MButton {

		public EffectButton(ButtonLayout layout) {
			super(getImageObserver(), layout, false, "Effects");
		}

		@Override public void onClick(GameMenu menu) {
			menu.setPage(new EffectPage(getImageObserver(), layout,GraphicPage.this));
		}
		
	}

}
